-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Update NA repr #30821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update NA repr #30821
Conversation
@@ -354,10 +354,7 @@ class NAType(C_NAType): | |||
return NAType._instance | |||
|
|||
def __repr__(self) -> str: | |||
return "NA" | |||
|
|||
def __str__(self) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python will automatically use __repr__
if one isn't defined, so this was redundant.
I had to include |
On board with this once green |
some doc-test failures, otherwise lgtm. |
@@ -575,6 +575,7 @@ Other API changes | |||
Supplying anything else than ``how`` to ``**kwargs`` raised a ``TypeError`` previously (:issue:`29388`) | |||
- When testing pandas, the new minimum required version of pytest is 5.0.1 (:issue:`29664`) | |||
- :meth:`Series.str.__iter__` was deprecated and will be removed in future releases (:issue:`28277`). | |||
- Added ``<NA>`` to the list of default NA values for :meth:`read_csv` (:issue:`30821`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may want to also mention in the NA section
I think you need to update the tests if a nullable integer / bool / string array appears in Series/DataFrame? (or does this not work yet)? |
It works. We have smoke tests in the base class. Will add some dedicated ones. |
Passing now. Merging in an hour. |
Can you explain why? Pandas does not write such format to CSV files, so it shouldn't be needed for a roundtrip |
@@ -1230,7 +1230,7 @@ def _format(x): | |||
if x is None: | |||
return "None" | |||
elif x is NA: | |||
return "NA" | |||
return formatter(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that the formatter
function needs to be able to handle NAs, which now is maybe not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do a PR for this, I think this breaks geopandas
Closes #30415
I think adding color with ANSI codes / custom HTML formatting is still worth doing as in #30778, but this is an improvement for now.